package com.sl.au.service.impl;

import java.util.List;

import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;

import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.sl.au.service.MyMoneyInfoService;

@Service("MyMoneyInfoService")
@Transactional
public class MyMoneyInfoServiceImpl implements MyMoneyInfoService {
	@PersistenceContext
	private EntityManager em;

	@Override
	public List getMyMoneyChartsService(int queryType, String beginDate, String endDate, String deptName, String arear,String person) {
		// TODO Auto-generated method stub
		return this.em.createNativeQuery("{call getMyMoneyChart(?,?,?,?,?,?)}")
				.setParameter(1, queryType)
				.setParameter(2, beginDate)
				.setParameter(3, endDate == null ? "" : endDate)
				.setParameter(4, deptName == null ? "" : deptName)
				.setParameter(5, arear == null ? "" : arear)
				.setParameter(6, person == null ? "" : person)
				.getResultList();
	}
}
